package com.by.hellosecurityoauth2.domain;

import java.io.Serializable;
import javax.persistence.*;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

/**
 * 用户角色(TUserRole)
 *
 * @author 白羽
 * @Date 2022-12-13 09:43:46
 */

@ApiModel
@Setter
@Getter
@ToString
@Entity
@Table(name = "t_user_role")
public class TUserRole implements Serializable {

    private static final long serialVersionUID = 924891221081720798L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @ApiModelProperty(value = "用户id")
	@Column(name = "user_id")
    private Long userId;
    
    @ApiModelProperty(value = "角色id")
	@Column(name = "role_id")
    private Long roleId;

    @ManyToOne
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "role_id", referencedColumnName = "id", insertable = false, updatable = false)
    @ApiModelProperty(value = "角色")
    private TRole role;

}